from django.db import models

# Create your models here.
class Area(models.Model):
    name = models.CharField(verbose_name='区域', max_length=20)
    parent = models.ForeignKey('self', on_delete=models.SET_NULL, verbose_name='父类区域', null=True, blank=True)

    class Meta:
        db_table = 'tb_areas'

    # 打印Area对象的时候,为了方便看的清除,重写__str__方法
    def __str__(self):
        return self.name